package com.qidian.mes.cal.controller;

import com.qidian.mes.cal.service.CalTeamService;
import com.qidian.mes.pojo.CalTeam;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author zhangYu
 * @Company 起点编程
 * @Time 2023/10/26 15:58
 * @Description
 */
@RestController
@CrossOrigin
@RequestMapping("/calTeam")
public class CalTeamController {
    @Autowired
    private CalTeamService calTeamService;

    @GetMapping("/get")
    public MESResult get(Long teamId){
        return calTeamService.get(teamId);
    }

    @GetMapping("/list")
    public MESResult list(@RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10") int limit, CalTeam calTeam){
        return calTeamService.list(page,limit,calTeam);
    }

    @PostMapping("/save")
    public MESResult save(@RequestBody CalTeam calTeam) {
        return calTeamService.save(calTeam);
    }
    @PutMapping("/update")
    public MESResult update(@RequestBody CalTeam calTeam) {
        return calTeamService.update(calTeam);
    }

    @GetMapping("/deleteByTeamId")
    public MESResult deleteByTeamId(Long deleteByteamId) {
        return calTeamService.deleteByCalTeamId(deleteByteamId);
    }
    @GetMapping("/deleteByTeamCode")
    public MESResult deleteByTeamCode(String deleteByteamCode) {
        return calTeamService.deleteByCalTeamCode(deleteByteamCode);
    }
}
